package com.nuoniu.sibanyun.mapper.production;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nuoniu.sibanyun.entity.production.ErpBomGroup;
import com.nuoniu.sibanyun.entity.production.ErpBomMain;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author baiqiang
 * @since 2021-01-08
 */
@Component
@Mapper
public interface VBomMainMapper extends BaseMapper<ErpBomMain> {

    @Select("select * from mab_bom where inventory_id=#{inventoryId} and version_code=#{versionCode}")
    ErpBomMain getBomByVersion(Integer inventoryId, String versionCode);

    @Select("select count(1) from mab_bom where process_route_id=#{id}")
    Integer getByPRId(Long id);

    @Update("update mab_bom set bom_group_name=#{name} where bom_group_id=#{id}")
    void updateGroupName(ErpBomGroup bomGroup);

    @Select("select count(1) from mab_bom where bom_group_id=#{id}")
    Integer getCountByGroupId(Long id);
}
